home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-05-21 | 2.6 KB | 89 lines | [TEXT/ttxt] |
- --<<<
- -- Filename:
- -- converter.sx
-
- -- Purpose:
- -- This file imports a Director title, and prints information
- -- about the cast to a file called castData.txt in theScriptDir
- -- and information about the score to a file called scorData.txt.
-
-
- -- Specialized Classes:
- -- This file uses classes defined in the files myCtrans.sx
- -- and myStrans.sx
-
- -- Instructions to User:
- -- Make sure myCtrans.sx and myStrans.sx live in the
- -- same folder as this file.
- -- Load this file. When the "Choose File" dialog box appears,
- -- choose a Director file to import.
- -- When the importing is finished, look in the files
- -- castData.sxt and scorData.sxt for information
- -- about the cast and score.
-
- -- Author:
- -- Jocelyn Becker
- ---------------------------------------------------------------
- ---------------------------------------------------------------
-
- -- load the DTK
- open TitleContainer dir:theStartDir path:"utils/dtk/dtk.sxt"
-
- -- Create a module to work in
- module myModule
- uses DTK
- uses ScriptX
- end
-
- in module myModule
-
- fileIn theScriptdir name:"myCtrans.sx"
- fileIn theScriptdir name:"myStrans.sx"
-
- -- make sure we are still in myModule
- in module myModule
-
- -- Create a new DTK instance
- -- use the open file dialog box to allow the user to select a Director file
- global locPanel := new OpenPanel
- openFilePanel locPanel
- dirFile := locPanel.filename
-
- -- create an instance of DTK
- myDTK := new DTK directorFileName:dirFile
-
- -- if the files castData.txt and scoreData.txt already exist
- -- then delete them
- if isfile theScriptDir "castData.txt" do delete theScriptDir "castData.txt"
- if isfile theScriptDir "scoreData.txt" do delete theScriptDir "scorData.txt"
-
- -- create the files castData.txt and scoreData.txt
- createFile theScriptDir "castData.txt" @text
- createFile theScriptDir "scoreData.txt" @text
-
- -- Create the output streams for the translators
- global castStream := getStream theScriptDir "castData.txt" @readwrite
- global scoreStream := getStream theScriptDir "scoreData.txt" @readwrite
-
- -- Create a cast and score translator
- global myst := new ScoreToInfoTranslator outputstream:scoreStream
- global myct := new CastToInfoTranslator outputstream:castStream
-
- -- tell the cast translator what classes to use when translating
- -- shapes, bitmaps, text, and video
- myct.shapeClass := CastTwoDShape
- myct.textClass := CastTextPresenter
- myct.bitmapClass := CastTwoDShape
- myct.videoClass := CastMoviePlayer
-
- -- Associate the Cast Translator with the DTK instance.
- -- Associate the Score Translator with the DTK instance.
-
- myDTK.castTranslator := myct
- myDTK.scoreTranslator := myst
-
- -- Set the DTK to work to import the data:
- translateDirector myDTK
-
- -->>>
-